\hypertarget{short-captions-in-output}{%
\section{\texorpdfstring{Short captions in
\LaTeX~output}{Short captions in ~output}}\label{short-captions-in-output}}

For latex output, this filter uses the attribute \texttt{short-caption}
for figures so that the attribute value appears in the List of Figures,
if one is desired.

\hypertarget{usage}{%
\section{Usage}\label{usage}}

Where you would have a figure in, say, markdown as

\begin{verbatim}
![The caption](foo.png ) 
\end{verbatim}

You can now specify the figure as

\begin{verbatim}
![The long caption](foo.png){short-caption="a short caption"} 
\end{verbatim}

If the document metadata includes \texttt{lof:true}, then the List of
Figures will use the short caption. This is particularly useful for
students writing dissertations, who often have to include a List of
Figures in the front matter, but where figure captions themselves can be
quite lengthy.

\begin{verbatim}
pandoc --lua-filter=short-captions.lua article.md -o article.tex

pandoc --lua-filter=short-captions.lua article.md -o article.pdf
\end{verbatim}

\hypertarget{example}{%
\section{Example}\label{example}}

Fig.~\ref{fig:shortcap} is an interesting figure with a long caption,
but a short caption in the List of Figures.

\hypertarget{fig:shortcap}{%
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth,height=\textheight]{fig.pdf}
\caption[{A short caption with math \(x^n + y^n = z^n\)}]{This is an
\emph{extremely} interesting figure that has a lot of detail I will need
to describe in a few sentences. This figure has a short caption that
will appear in the list of figures. Other attributes are preserved}
\label{fig:shortcap}
\end{figure}
}

\hypertarget{limitations}{%
\section{Limitations}\label{limitations}}

\begin{itemize}
\tightlist
\item
  The filter will process the \texttt{short-caption} attribute value as
  pandoc markdown, regardless of the input format.
\item
  It does not work for tables and listings yet.
\item
  But it works with pandoc-crossref, regardless of the order of
  application.
\end{itemize}
